package free.emaranhado.lineparams.util;

public class Params {

	public double getDeqTF(double c1, double c2, double c3) {

		double Deq = Math.cbrt(c1 * c2 * c3);
		return Deq;
	}

	public double getInductanceTF(double ds, double c1, double c2, double c3) {

		double deq = getDeqTF(c1, c2, c3);
		double Leq = Math.log(deq / ds) * 0.0000002;
		return Leq;
	}
	
	public double getCapacitanceTF(double ds, double c1, double c2, double c3) {

		double deq = getDeqTF(c1, c2, c3);
		double Ceq = (2*3.14159265*8.8541878E-12)/Math.log(deq / ds);
		return Ceq;
	}

	public double getDMG(double[] distance, double[] radius) {
		double dmg = 0;
		int size = radius.length;

		double power = (size * size);
		power = 1 / power;

		double aux1 = 1;
		for (int i = 0; i < size; i++) {
			aux1 = aux1 * radius[i];
			for (int j = 0; j < size - 1; j++) {
				aux1 = aux1 * distance[j];
			}
		}

		dmg = Math.pow(aux1, power);

		return dmg;
	}
	
	/** convert inch to meters */
	public double in2mts(double in){
		return in*0.0254;
	}
	/** convert feet to meters */
	public double ft2mts(double ft){
		return ft*0.3048;
	}
	
	/** convert mile to meters */
	public double mi2mts(double mi){
		return mi*1609.344;
	}
	
	/** convert mm to meters */
	public double mm2mts(double mm){
		return mm*0.001;
	}
	
	/** convert cm to meters */
	public double cm2mts(double cm){
		return cm*0.01;
	}
	
}
